//二星 https://iai.sh.cn/problem/399
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, p;
  cin >> s >> p;
  int s_len = s.size();
  int p_len = p.size();
  if (s_len % p_len != 0) {
    cout << "No";
    return 0;
  } else {
    int i = 0;
    while (i < s_len ) {
      string subs = s.substr(i, p_len);
      if (subs != p) {
        cout << "No";
        return 0;
      }
      i += p_len;
    }
  }
  cout << "Yes";
  return 0;
}